package com.commpany.servie.basic.tag.business.read.productTag.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.commpany.jdq.core.orm.Pagination;
import com.commpany.servie.basic.tag.business.read.productTag.ProductTagReadManage;
import com.commpany.servie.basic.tag.dao.read.ProductTagReadDAO;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import com.commpany.jdq.core.common.PageResult;
import com.commpany.servie.basic.tag.po.ProductTagPO;
@Slf4j
@Service
public class ProductTagReadManageImpl  implements ProductTagReadManage {
	@Autowired
	private ProductTagReadDAO productTagReadDAO;
	
	@Override
    public ProductTagPO getProductTagService(ProductTagPO po){
         return  productTagReadDAO.findById(po);
    }
    @Override
	public PageResult<ProductTagPO> selectProductTagPageService(ProductTagPO po, Pagination page){
	    page.setLimitStart((page.getPageNo() - 1) * page.getPageSize());
		PageResult<ProductTagPO> result = new PageResult<ProductTagPO>();
		List<ProductTagPO> list = productTagReadDAO.findOfPage(po, page);
		int count = productTagReadDAO.countOfPage(po);
		result.setList(list);
		result.setTotalSize(count);
		result.copy(page);
		return result;
		
	}
	
    @Override
	public int countProductTagService( ProductTagPO po ){
	    return productTagReadDAO.countOfPage(po);
	
	}
	
    @Override
	public List<ProductTagPO> queryProductTagService(ProductTagPO po){
	   return  productTagReadDAO.findAll(po);
	}
	
}
	